{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ellipses\n",
    "\n",
    "The matrix representation of an ellipse can be seen as the transformation of the quadratic form $x^Tx$ induced by a matrix $A$\n",
    "\n",
    "$$\n",
    "    x^T A x\n",
    "$$\n",
    "\n",
    "For example, the ellipse \n",
    "$$\n",
    "    2x^2 -4xy + 5y^2\n",
    "$$\n",
    "\n",
    "can be represented as"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sympy as s\n",
    "from sympy import init_printing\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}2 x^{2} - 4 x y + 5 y^{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "Matrix([[2*x**2 - 4*x*y + 5*y**2]])"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x, y = s.symbols(\"x y\")\n",
    "\n",
    "A = s.Matrix([\n",
    "    [2, -2],\n",
    "    [-2, 5]\n",
    "])\n",
    "\n",
    "\n",
    "X = s.Matrix([\n",
    "    [x],\n",
    "    [y]\n",
    "])\n",
    "\n",
    "(X.T @ A @ X).expand()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWQAAADuCAYAAAAOR30qAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl81NW9//HXd/ZMMgk7hB1ZJEDYkgAqi6wiIAoooGjbW6jeX+uttfdhe3vb2+2h9ur19l7b3luLvV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cXU1pamqwyTS0WCFLz7Gs0e2AmmsNudDlCadDcmwSyMLWuXbtSWlpKq1atrvg4CeQvi1RWUbduE7mzbzW6FKE0KJBlDlmINGRr1wp7p3ZySGqKkUAWpnb06NGrjo7FpWXdNIjI8UrC5XJIaqqQQBYijeXOmUztsveInJEmRKlAAlmINJf3/2bhW/SWnFydAiSQhUhzmqbhmTVRThpJARLIQmQAW9uWOK7vRt07nxhdirgCCWQhMkTWsP6EyyuJ+euMLkVchgSyEBnEM2si3gVLjS5DXIYEshAZxOJykj1ppBySalISyEJkGHu3DuqQ1I07jS5FfIUEshAZyD3+BkL7j8n6ZJORQBYiA2mahueuCfhflUNSzUQCWYgMpTkd5Ewbi3ehrE82CwlkITKYLb81zsJe1H+4xehSBBLIQmQ8V3FfwuWnCB87aXQpGU8CWQiBZ8Z4ale8T6y23uhSMpoEshACzW7Dc89kfK+uMrqUjCaBLIQAwNrMg2tQAf4V7xtdSsZq7BFOQpiSpmkrdV2faHQdQjSFBLIQQpiETFkIIYRJSCALIYRJSCALIYRJSCALIYRJSCALIYRJSCALIYRJSCALIYRJSCALIYRJSCALIYRJ/H+v9yd0Pd4mTgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "e1 = 2 * x ** 2  - 4 * x * y + 5 * y ** 2 - 10\n",
    "e2 = (2 * x + y) / np.sqrt(5)\n",
    "e3 = (x - 2 * y) / np.sqrt(5)\n",
    "c1 = s.plotting.plot_implicit(e1, show=False)\n",
    "c2 = s.plotting.plot_implicit(e2, line_color=\"crimson\", show=False)\n",
    "c3 = s.plotting.plot_implicit(e3, line_color=\"crimson\", show=False)\n",
    "\n",
    "c1.extend(c2)\n",
    "c1.extend(c3)\n",
    "c1.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "from scipy.linalg import eig\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "An = np.array([\n",
    "    [2, -2],\n",
    "    [-2, 5]\n",
    "])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(array([1.+0.j, 6.+0.j]), array([[-0.89442719,  0.4472136 ],\n",
       "        [-0.4472136 , -0.89442719]]))"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eig(An)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
